package com.aest.execution.service.impl;

import java.util.List;
import com.aest.common.utils.DateUtils;
import com.aest.common.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.aest.execution.mapper.ExecutionRecordMapper;
import com.aest.execution.domain.ExecutionRecord;
import com.aest.execution.service.IExecutionRecordService;

/**
 * 任务执行记录Service业务层处理
 * 
 * @author Lanwen.jc
 * @date 2025-07-31
 */
@Service
public class ExecutionRecordServiceImpl implements IExecutionRecordService 
{
    @Autowired
    private ExecutionRecordMapper executionRecordMapper;

    /**
     * 查询任务执行记录
     * 
     * @param id 任务执行记录主键
     * @return 任务执行记录
     */
    @Override
    public ExecutionRecord selectExecutionRecordById(Long id)
    {
        return executionRecordMapper.selectExecutionRecordById(id);
    }

    /**
     * 查询任务执行记录列表
     * 
     * @param executionRecord 任务执行记录
     * @return 任务执行记录
     */
    @Override
    public List<ExecutionRecord> selectExecutionRecordList(ExecutionRecord executionRecord)
    {
        return executionRecordMapper.selectExecutionRecordList(executionRecord);
    }

    /**
     * 新增任务执行记录
     * 
     * @param executionRecord 任务执行记录
     * @return 结果
     */
    @Override
    public int insertExecutionRecord(ExecutionRecord executionRecord)
    {
        executionRecord.setCreateTime(DateUtils.getNowDate());
        executionRecord.setExecutionId(IdUtils.simpleUUID());
        return executionRecordMapper.insertExecutionRecord(executionRecord);
    }

    /**
     * 修改任务执行记录
     * 
     * @param executionRecord 任务执行记录
     * @return 结果
     */
    @Override
    public int updateExecutionRecord(ExecutionRecord executionRecord)
    {
        executionRecord.setUpdateTime(DateUtils.getNowDate());
        return executionRecordMapper.updateExecutionRecord(executionRecord);
    }

    /**
     * 批量删除任务执行记录
     * 
     * @param ids 需要删除的任务执行记录主键
     * @return 结果
     */
    @Override
    public int deleteExecutionRecordByIds(Long[] ids)
    {
        return executionRecordMapper.deleteExecutionRecordByIds(ids);
    }

    /**
     * 删除任务执行记录信息
     * 
     * @param id 任务执行记录主键
     * @return 结果
     */
    @Override
    public int deleteExecutionRecordById(Long id)
    {
        return executionRecordMapper.deleteExecutionRecordById(id);
    }
}
